#ifndef __FIFOTHREAD_H__
#define __FIFOTHREAD_H__

/*
 * structure stockee dans la fifo thread
 */

typedef struct element {
  thread * th;
  struct element * next;
  struct element * previous;
} element;

/*
 * Structure fifo des threads: pointeurs sur tete et queue  
 */

typedef struct fifoThread {
  element * head;
  element * tail;
}fifoThread;

fifoThread * createFifoThread();

int hasMoreThanOneElement(fifoThread * fifo);

int isEmptyFifo(fifoThread * fifo);

void initFifoThread(fifoThread * fifo);

void killFifoThread(fifoThread * fifo);

thread* findThreadByTid (fifoThread* f,int tid);

thread* removeThreadByTid (fifoThread * f,int tid);

thread* removeBigPriority (fifoThread * f);

void addFifoThread(fifoThread *fifo, thread *th);

struct thread* getFifoHead (fifoThread* fifo);

struct thread* removeFifoHead (fifoThread* fifo);

void killThreadChildrenFromFIFO(int tid, fifoThread *f);
#endif
